<div id="content" style="padding : 10px">
    <form action="" method="post">
    <h3 class="title-popup">Hak Akses Pengguna</h3>
    <div class="DivTable">
        <table class="GridTable" style="margin-top:10px; clear:both; width:100%">
            <tbody>
                <tr class="GridHeader">
                    <td style="width:30px">
                        No.
                    </td>
                    <td style="width:30px">
                        ID
                    </td>
                    <td>
                        Nama Menu
                    </td>
                    <td>
                        Grup Menu
                    </td>
                    <td>
                        Read<br/>
                        <input type="checkbox" name="all_read" id="all_read" value="1" />
                    </td>
                    <td>
                        Edit<br/>
                        <input type="checkbox" name="all_edit" id="all_edit" value="1" />
                    </td>
                    <td>
                        Delete<br/>
                        <input type="checkbox" name="all_delete" id="all_delete" value="1" />
                    </td>
                </tr>
                <?php $counter = 0; ?>
                <?php foreach($menus_final as $menu): ?>
                    <tr class="GridItem1">
                        <td>
                            <?php echo $counter+1; ?>
                        </td>
                        <td>
                            <?php echo $menu["id_menu"] ?>
                        </td>
                        <td>
                            <?php echo $menu["menu"] ?>
                        </td>
                        <td>
                            <?php echo $menu["menu_group"] ?>
                        </td>
                        <td>
                            <input type="checkbox" class="read_checkbox" name="hak_akses[<?php echo $menu["id_menu"] ?>][read]" value="1" <?php echo $menu["is_read"] == 1?" checked = 'true'":"" ?> />
                        </td>
                        <td>
                            <input type="checkbox" class="edit_checkbox" name="hak_akses[<?php echo $menu["id_menu"] ?>][edit]" value="1" <?php echo $menu["is_modify"] == 1?" checked = 'true'":"" ?> />
                        </td>
                        <td>
                            <input type="checkbox" class="delete_checkbox" name="hak_akses[<?php echo $menu["id_menu"] ?>][delete]" value="1" <?php echo $menu["is_delete"] == 1?" checked = 'true'":"" ?> />
                        </td>
                    </tr>
                    <?php $counter++; ?>
                <?php endforeach; ?>
            </tbody>
        </table>
        <div style="margin-top:10px">
            <input type="submit" class="CommandButton" name="btnSimpan" value="Save"/>&nbsp;
            <input type="button" class="CommandButton" value="Cancel" onclick="javascript:closeGB_();"/>
        </div>
    </div>
</form>
</div>
<br class="bersih" />
<script type="text/javascript">
    function closeGB_ ()
    {
        <?php echo CloseGB(true); ?>
    }
    
    jQuery(function(){
        jQuery("#all_read").click(function(){
            if(jQuery(this).attr("checked")){
                jQuery(".read_checkbox").attr("checked", true);
            }else{
                jQuery(".read_checkbox").removeAttr("checked");
            }
        })
        
        jQuery("#all_edit").click(function(){
            if(jQuery(this).attr("checked")){
                jQuery(".edit_checkbox").attr("checked", true);
            }else{
                jQuery(".edit_checkbox").removeAttr("checked");
            }
        })
        
        jQuery("#all_delete").click(function(){
            if(jQuery(this).attr("checked")){
                jQuery(".delete_checkbox").attr("checked", true);
            }else{
                jQuery(".delete_checkbox").removeAttr("checked");
            }
        })
    })
</script>